/*
 * File: vfsdriver.c
 *
 * Description: This is a driver program for testing your VFS system using an interaction script as input
 * You need to make additional calls to your respective functions as noted in the comments below
 * Make sure the output you display is exactly as per the given specifications for you. Do NOT print
 * any extra output (like debug messages) in the final version of your driver program. You can use this driver program
 * in a in incremental manner as you keep implementing one operator after another. For operators not yet implemented,
 * you can leave the output as given ("TO_BE_DONE"). So you can use this program as your "main" program for testing purposes.
 *
 * DO NOT write the full code for operators in the driver program! You must only CALL your functions from here.
 *
 * Usage: vfsdriver <scriptfilename>
 */

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define BUFSIZE 200
#define CMDSIZE 30
#define PARSIZE 100
#include "../include/global.h"
#include "../include/vfs_errorcodes.h"

extern int ismounted = 0;
extern global* globaldata;

void createvfs(char *P1, int P2);
void mountvfs(char *P1);
void unmountvfs(char *P1);
void makedir(char *P1, char *P2);
void deletedir(char *P1);
void movedir(char *P1, char *P2);
void listdir(char *P1, int P2, char *P3);
void addfile(char *P1, char *P2, char *P3);
void listfile(char *P1, char *P2);
void updatefile(char *P1, char *P2);
void removefile(char *P1);
void movefile(char *P1, char *P2);
void copyfile(char *P1, char *P2);
void exportfile(char *P1, char *P2);
void searchfile(char *P1, char *P2);

void processcommand(char *command, char *P1, char *P2, char *P3);

char* trim(char* data) {
	char* result = (char *) malloc(sizeof(char) * MAX_PATH_SIZE);
	char temp[MAX_PATH_SIZE];
	char *first = strchr(data, ' ');
	if (first != NULL ) {
		strcpy(temp, first + 1);
	} else {
		strcpy(temp, data);
	}
	char *last = strchr(temp, ' ');
	if (last != NULL ) {
		strncpy(result, temp, last - temp);
	} else {
		strcpy(result, temp);
	}
	return result;
}


int main(int argc, char *argv[]) {
	globaldata = (global*) malloc(sizeof(global));
	FILE *scriptfp;
	char linebuffer[BUFSIZE];
	char command[CMDSIZE], par1[PARSIZE], par2[PARSIZE], par3[PARSIZE];
	char *token;

	if (argc != 2) {
		fprintf(stderr, "Usage: vfsdriver <scriptfile>\n");
		return (1);
	}

	if ((scriptfp = fopen(argv[1], "r")) == NULL ) {
		fprintf(stderr, "Unable to open script file: %s\n", argv[1]);
		return (2);
	}
	while (fgets(linebuffer, sizeof(linebuffer), scriptfp) != NULL ) {
		/* This output is for debugging... do not uncomment in final version */
		/*
		 printf("==================================================\n");
		 printf("Processing: %s", linebuffer);
		 printf("==================================================\n");
		 */

		/* Remove the extra newline character in the end of line */
//		linebuffer[strlen(linebuffer)] = ' ';
		linebuffer[strlen(linebuffer) - 1] = '\0';
		/* Get the command and the parameters using tokenizer */
		strcpy(command, (token = strtok(linebuffer, " ")) == NULL ? "" : token);

		strcpy(par1, (token = strtok(NULL, " ")) == NULL ? "" : token);
		strcpy(par2, (token = strtok(NULL, " ")) == NULL ? "" : token);
		strcpy(par3, (token = strtok(NULL, " ")) == NULL ? "" : token);
		/*printf("Command:%s:p1:%s:p2:%s:p3:%s\n",command, par1, par2, par3);*/
		processcommand(command, par1, par2, par3);
	}
	return 0;
}

void processcommand(char *command, char *P1, char *P2, char *P3) {
	if (strcmp(command, "createvfs") == 0) {
		if (strcmp(P2, "") == 0 || P2 == NULL ) {
			printf("createvfs_VFS_INSUFFICIENT_ARGUMENTS\n");
		} else {
			int size = atoi(P2);
			createvfs(P1, size);
		}
	} else if (strcmp(command, "mountvfs") == 0)
		mountvfs(P1);
	else if (strcmp(command, "unmountvfs") == 0)
		unmountvfs(P1);
	else if (strcmp(command, "makedir") == 0)
		makedir(P1, P2);
	else if (strcmp(command, "deletedir") == 0)
		deletedir(P1);
	else if (strcmp(command, "movedir") == 0)
		movedir(P1, P2);
	else if (strcmp(command, "listdir") == 0) {
		int flag = atoi(P2);
		listdir(P1, flag, P3);
	} else if (strcmp(command, "addfile") == 0)
		addfile(P1, P2, P3);
	else if (strcmp(command, "listfile") == 0)
		listfile(P1, P2);
	else if (strcmp(command, "updatefile") == 0)
		updatefile(P1, P2);
	else if (strcmp(command, "removefile") == 0)
		removefile(P1);
	else if (strcmp(command, "movefile") == 0)
		movefile(P1, P2);
	else if (strcmp(command, "copyfile") == 0)
		copyfile(P1, P2);
	else if (strcmp(command, "exportfile") == 0)
		exportfile(P1, P2);
	else if (strcmp(command, "searchfile") == 0)
		searchfile(P1, P2);
	else
		printf("Ignoring invalid command %s\n", command);
}

void createvfs(char *P1, int P2) {
	char *command_name = "createvfs";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P1) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else {
		//P1 = trim(P1);
		result = vfscreate(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_04);
		break;
	case 5:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_05);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_CREATE_00);
		break;
	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void mountvfs(char *P1) {
	char *command_name = "mountvfs";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P1) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else {
		result = vfsmount(P1);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOUNT_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOUNT_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOUNT_03);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOUNT_00);
		break;
	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void unmountvfs(char *P1) {
	char *command_name = "unmountvfs";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P1) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else {
		result = vfsunmount(P1);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UNMOUNT_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UNMOUNT_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UNMOUNT_03);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UNMOUNT_00);
		break;
	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void makedir(char *P1, char *P2) {
	char *command_name = "makedir";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else {
		result = vfsmakedir(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MAKEDIR_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MAKEDIR_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MAKEDIR_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MAKEDIR_05);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MAKEDIR_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;
	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void deletedir(char *P1) {
	/*	  */
	char *command_name = "deletedir";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P1) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfsdeletedir(P1);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_DELETEDIR_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_DELETEDIR_02);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_DELETEDIR_04);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_DELETEDIR_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void movedir(char *P1, char *P2) {
	char *command_name = "movedir";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/' || P2[0] != '/') {
		result = 11;
	} else {
		result = vfsmovedir(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_02);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_04);
		break;
	case 5:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_05);
		break;
	case 6:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_06);
		break;
	case 7:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_07);
		break;
	case 8:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_08);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEDIR_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void listdir(char *P1, int P2, char *P3) {
	char *command_name = "listdir";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P3 == NULL || strlen(P1) == 0 || strlen(P3) == 0) {
		if (P2 != 0 || P2 != 1)
			isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfslistdir(P1, P2, P3);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTDIR_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTDIR_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTDIR_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTDIR_04);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTDIR_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void addfile(char *P1, char *P2, char *P3) {
	char *command_name = "addfile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || P3 == NULL || strlen(P1) == 0
			|| strlen(P2) == 0 || strlen(P3) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfsaddfile(P1, P2, P3);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_04);
		break;
	case 5:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_05);
		break;
	case 6:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_06);
		break;
	case 7:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_07);
		break;
	case 8:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_08);
		break;
	case 9:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_09); //#define ERR_VFS_ADDFILE09 "DIRECTORY_DOES_NOT_EXIST"
		break;

	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"EXTRA_ERRORCODE_ROOT_MISSING_IN_DIR_PATH");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void listfile(char *P1, char *P2) {
	char *command_name = "listfile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfslistfile(P1, P2);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTFILE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTFILE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_LISTFILE_04);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_ADDFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void updatefile(char *P1, char *P2) {

	char *command_name = "updatefile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfsupdatefile(P1, P2);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UPDATEFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UPDATEFILE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UPDATEFILE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UPDATEFILE_04);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_UPDATEFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void removefile(char *P1) {
	char *command_name = "removefile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P1) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfsremovefile(P1);

	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_REMOVEFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_REMOVEFILE_02);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_REMOVEFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}

}

void movefile(char *P1, char *P2) {

	char *command_name = "movefile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/' || P2[0] != '/') {
		result = 11;
	} else {
		result = vfsmovefile(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEFILE_02);
		break;
	case 6:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEFILE_06);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_MOVEFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}

}

void copyfile(char *P1, char *P2) {
	char *command_name = "copyfile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/' || P2[0] != '/') {
		result = 11;
	} else {
		result = vfscopyfile(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_04);
		break;
	case 5:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_05);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_COPYFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
	//printf("copyfile_TO_BE_DONE\n");
}

void exportfile(char *P1, char *P2) {

	char *command_name = "exportfile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || P2 == NULL || strlen(P1) == 0 || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else if (P1[0] != '/') {
		result = 11;
	} else {
		result = vfsexportfile(P1, P2);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS\n", command_name);
		break;
	case 1:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_EXPORTFILE_01);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_EXPORTFILE_02);
		break;
	case 3:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_EXPORTFILE_03);
		break;
	case 4:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_EXPORTFILE_04);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_EXPORTFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"VFS_NOT_MOUNTED");
		break;

	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}

void searchfile(char *P1, char *P2) {
	int *count;
	char *command_name = "searchfile";
	int isinsufficientagrument = -1, result;
	if (P1 == NULL || strlen(P2) == 0) {
		isinsufficientagrument = 0;
	}
	if (isinsufficientagrument == 0) {
		result = 10;
	} else {

		result = vfssearchfile(P1, P2,&count);
		//printf("count is %d", count);
	}
	switch (result) {
	case 0:
		printf("%s_SUCCESS %d\n", command_name,count);
		break;
	case 2:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_SEARCHFILE_02);
		break;
	case 10:
		printf("%s_FAILURE %s\n", command_name, ERR_VFS_SEARCHFILE_00);
		break;
	case 11:
		printf("%s_FAILURE %s\n", command_name,
				"EXTRA_ERRORCODE_CANNOT_CREATE_SPECIFIED_OUTPUTFILE");
		break;
	default:
		printf("%s_UNEXPECTED\n", command_name);
		break;
	}
}
